package org.irri.smta.ui.bean;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;

import org.irri.smta.common.Constants;
import org.irri.smta.domain.Material;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Named("fileLinkBean")
@ViewScoped
public class FileLinkBean extends SelectableTableBeanBase<Material> {

	private static final long serialVersionUID = 1L;
	private static final Logger LOGGER = LoggerFactory
			.getLogger(FileLinkBean.class);

	private String smtaFileUrl = "#";
	private String mtaFileUrl = "#";

	public FileLinkBean() {
		super();
		setViewName(Constants.FILE_LINK_VIEW_NAME);
	}

	@PostConstruct
	public void init() {
		LOGGER.debug("init()");
	}

	@Override
	public Object getRowKey(Material object) {
		throw new UnsupportedOperationException("getRowKey is not supported.");
	}

	@Override
	public Material getRowData(String rowKey) {
		throw new UnsupportedOperationException("getRowData is not supported.");
	}

	public String getSmtaFileUrl() {
		return smtaFileUrl;
	}

	public void setSmtaFileUrl(String smtaFileUrl) {
		this.smtaFileUrl = smtaFileUrl;
	}

	public String getMtaFileUrl() {
		return mtaFileUrl;
	}

	public void setMtaFileUrl(String mtaFileUrl) {
		this.mtaFileUrl = mtaFileUrl;
	}

	public Boolean isMtaExists() {
		return !("#").equals(mtaFileUrl);
	}
	
}
